package org.window;

import com.scm.all.export.ProcessAndThreadUtils;
import com.scm.all.export.SystemUtils;
import com.scm.all.export.WindowOperationUtils;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class PaneController {
    public static Pane pane1 = new Pane();
    public static Stage stage = new Stage();
    public static void PaneController(Stage primaryStage){
        primaryStage.setTitle("JAVAFX-FindMemoryAddress-内存搜索工具V1.0.0");
        primaryStage.setWidth(500);
        primaryStage.setHeight(730);
        stage = primaryStage;
        pane1.setPrefWidth(primaryStage.getWidth());
        pane1.setPrefHeight(primaryStage.getHeight());
        pane1.setStyle("-fx-background-color: #f5f4e6;");
        init();
        primaryStage.setScene(new Scene(pane1));
        primaryStage.setResizable(false);
        primaryStage.getScene().getStylesheets().addAll(PaneController.class.getClassLoader().getResource("style.css").toExternalForm());
        if(!ProcessAndThreadUtils.elevatePrivileges(ProcessAndThreadUtils.openProcess(ProcessAndThreadUtils.getCurrentProcessId()),4)){
            SystemUtils.messageBoxExW(WindowOperationUtils.windowGetHwnd(),"提升权限失败","温馨提示",0);
        }else {
            System.out.println("进程提升权限成功,但是低于驱动权限！");
        }
        primaryStage.show();
    }
    public static void init(){
        pane1.getChildren().addAll(PaneAndHBoxFrame.hBox,
                PaneAndHBoxFrameDataInfo.hBox,
                PaneAndHBoxFrameAndColumn.hBox,
                PaneAndHBoxFrameAndColumnVBoxAndPane.pane,
                PaneAndHBoxFrameAndColumnVBoxAndPaneTypeData.pane,
                PaneAndHBoxFrameAndColumnVBoxAndHBoxTools.hBox,
                PaneControllerAndPane.pane,
                PaneControllerAndHBoxState.hBox
        );
        PaneAndHBoxFrame.init();
        PaneAndHBoxFrameDataInfo.init();
        PaneAndHBoxFrameAndColumn.init();
        PaneAndHBoxFrameAndColumnVBoxAndPane.init();
        PaneAndHBoxFrameAndColumnVBoxAndPaneTypeData.init();
        PaneAndHBoxFrameAndColumnVBoxAndHBoxTools.init();
        PaneControllerAndPane.init();
        PaneControllerAndHBoxState.init();
    }
}
